package oop.ex2.commands;

import oop.ex2.expression.ExpressionSolver;

/**
 * This assignment command implements the basic assignment functionality. If the variable
 * exists, it simply changes it's value. Otherwise, it adds the value to the expression solver's
 * variable table.
 * @author daniel_i_l
 *
 */
public class BasicAssignmentCommand extends AssignmentCommand {
	static final String ASSIGNMENT_OP = "=";
	
	/**
	 * Build a basic assignment operation command using a given expression solver and assignment
	 * operation string.
	 * @param expressionSolver The expression solver to use.
	 * @param assignmentOp The assignment operation string to look for.
	 */
	
	public BasicAssignmentCommand(ExpressionSolver expressionSolver) {
		super(expressionSolver, ASSIGNMENT_OP);
	}

	@Override
	protected void assignValue(String varName, double expVal) {
		_expressionSolver.setVarValue(varName, expVal);
	}


}
